package FinalAndStatic.demo02;

public class Sun {
        private static final Sun instance = new Sun();
        private Sun() {
        }

        public static Sun getInstance() {
            return instance;
        }

        public void shine() {
            System.out.println("The sun is shining.");
        }
    public static void main(String[] args) {
        Sun sun1 = Sun.getInstance();
        Sun sun2 = Sun.getInstance();
        System.out.println("sun1 和 sun2 是否为同一个实例: " + (sun1 == sun2));
        sun1.shine();
    }
}
